<template>
    <Crud table="opera" join_table="category" :columns="columns" v-model:saveFormData="saveFormData" v-model:searchObj="searchObj">
        <template #save>
            <a-form
                ref="save_form"
                :model="saveFormData"
                :label-col="{ span: 6 }"
                :wrapper-col="{ span: 18 }"
            >
              <a-form-item label="剧名" name="name" :rules="[{ required: true, message: '' }]">
                  <a-input v-model:value="saveFormData.name"/>
              </a-form-item>
              <a-form-item label="封面图片" name="logo_img">
                <Upload :maxCount="1" v-model:value="saveFormData.logo_img"/>
              </a-form-item>
              <a-form-item label="免费集数" name="free_num" :rules="[{ required: true, message: '' }]">
                <a-input v-model:value="saveFormData.free_num"/>
              </a-form-item>
              <a-form-item label="排序数字(越大越靠前)" name="sort_num" :rules="[{ required: true, message: '' }]">
                <a-input v-model:value="saveFormData.sort_num"/>
              </a-form-item>
              <a-form-item label="每集价格" name="v_money" :rules="[{ required: true, message: '' }]">
                <a-input v-model:value="saveFormData.v_money"/>
              </a-form-item>
              <a-form-item label="分类" name="category_id" :rules="[{ required: true, message: '' }]">
                <RemoteSelect table="category" name_key="cat_name" v-model:value="saveFormData.category_id"/>
              </a-form-item>


            </a-form>
        </template>
        <template #search>
            <a-form
                layout="inline"
            >
              <a-form-item>
                <a-input placeholder="剧名" v-model:value="searchObj.name"/>
              </a-form-item>
              <a-form-item>
                <RemoteSelect table="category" name_key="cat_name" v-model:value="searchObj.category_id"/>
              </a-form-item>
            </a-form>
        </template>
    </Crud>
</template>

<script>

export default {
    name: "list",
    data: function () {
        return {
            saveFormData: {
              sort_num:50
            },
            searchObj: {},
            columns: [
                {
                    title: '剧名',
                    key: 'name',
                },{
                    title: '封面图片',
                    key: 'logo_img',
                },{
                    title: '免费集数',
                    key: 'free_num',
                },{
                    title: '排序数字',
                    key: 'sort_num',
                },{
                    title: '每集价格',
                    key: 'v_money',
                },{
                    title: '分类',
                    key: 'category_id',
                    render:(e)=>{
                      return e.category_info.cat_name
                    }
                },{
                    title: '观看次数',
                    key: 'view_count',
                },{
                    title: '添加时间',
                    key: 'add_time',
                },
            ],
        };
    },
    components: {},
    created() {
    },
    methods: {
    }
}
</script>

<style scoped lang="less">

</style>